package com.hex.ds.hdtp.core.app.script.transfer.dto.response;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hex.ds.hdtp.core.app.common.util.FileEncodeUtil;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.io.FilenameUtils;

import java.io.File;

/**
 * @Package: com.hex.ds.hdtp.core.app.transfer.script.dto.response
 * @ClassName ScriptConvertListResponseDto
 * @Description: 脚本转换清单-response对象
 * @Author: wz.li
 * @Date 2023/2/12 10:35
 * @Version v2.0.2
 **/
@Data
@Accessors(chain = true)
public class ScriptConvertSourceListResponseDto {

    private String pkId;

    private String convertTaskPkId;

    private String sourceConnCode;

    private String targetConnCode;

    private String sourceFileName;

    private String sourceFilePath;

    private String sourceFileSize;

    private String convertFileName;

    private String convertFilePath;

    private String convertFileSize;

    private String status;

    private String convertStartTs;

    private String convertEndTs;

    private String convertLog;

    private String sourceFileContent;

    private String convertFileContent;

    private String sourceFileAbsolutePath;

    private String convertFileAbsolutePath;

    private String isSourceFileEdit = "N";

    private String isConvertFileEdit = "N";

    private String crtUser;

    private String crtUserName;

    private String crtTs;

    private String convertTargetPkId;

    private String emptyTestStatus;

    public String getSourceFileAbsolutePath() {
        return FilenameUtils.separatorsToUnix(sourceFilePath + File.separator + sourceFileName);
    }

    public String getConvertFileAbsolutePath() {
        String pyFileName = sourceFileName.substring(0, sourceFileName.lastIndexOf(".")) + ".py";
        return FilenameUtils.separatorsToUnix(convertFilePath + File.separator + pyFileName);
    }

}
